<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>自定义指令</title>
	<script type="text/javascript" src="js/vue.js"></script>
</head>
<body>
	<div class="container">
		<h2 v-hello>{{msg}}</h2>
		
	</div>
	<script type="text/javascript">
		/**
			自定义全局指令
		*/
		Vue.directive('hello',{//5个根函数
			bind(){
				alert("111");
			},
			insert(){

			},
			update(){

			},
			componentUpdate(){
				alert("被绑定的函数");
			},
			unbind(){
				console.log("解绑，销毁操作");
			}
		});
		var vm = new Vue({
			el:'.container',
			data:{
				msg:'welcome to Vue!'
			},
			methods:{

			}
		});
	</script>
	
</body>
</html>